Note to VB.NET Users

To conserve space we have shown most code examples in only C#, however VB.NET examples are available in the example source folders.

Simple GUI Text Editor With Dialog Checking

To use the GUI dialog spell checker control (RapidSpellDialog) as an integral part of your application simply instantiate it, set the text component you wish this GUI to spell check and call Check(), which will bring up this component in a new Form allowing the user to correct their document in the TextBoxBase derived class.

Example, note this code is highly simplistic for demonstration purposes.

Code Example

using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
using Keyoti.RapidSpell;

public class GUIExample : Form{
    RapidSpellDialog rs;
    TextBox tb = new TextBox();

    MainMenu mainMenu1;
    MenuItem menuItem1, menuItem2;

    public GUIExample() : base() {
        //set up the text box
        tb.Size = new Size(500,352);
        tb.Multiline = true;
        Controls.Add(tb);

        //config menu
        mainMenu1 = new MainMenu();
        menuItem1 = new MenuItem();
        menuItem2 = new MenuItem();
        mainMenu1.MenuItems.AddRange(new MenuItem[] { menuItem1 });
        menuItem1.Index = 0;
        menuItem1.MenuItems.AddRange(new MenuItem[] {menuItem2 } );
        menuItem1.Text = "Tools";
        menuItem2.Index = 0;
        menuItem2.Text = "Check Spelling";
        //listen to clicks
        menuItem2.Click += new EventHandler(StartRS);
        Menu = mainMenu1;

        //set form size
        Size = new Size(510,400);

        //configure spell checker
        rs = new RapidSpellDialog();
        rs.TextBoxBaseToCheck = tb;
    }

    //run spell check when the menu is clicked
    private void StartRS(object sender, EventArgs args){
        rs.Check();
    }

	public static void Main(String[] args) {
        Application.Run( new GUIExample() );
    }
}